import { fileServiceApi } from '../config'

import request from '@/utils/request'

const baseApi = '/uploads'

/**
 * params: {folder:"foloder"}
 *
 * 参数带上文件所放的文件夹
 *
 * /uploads?folder=user
 */
const uploadUrl = process.env.VUE_APP_BASE_API + fileServiceApi + baseApi
export { uploadUrl }

export function upload(data) {
  return request({
    headers: { 'Content-Type': 'multipart/form-data' },
    url: fileServiceApi + baseApi,
    method: 'POST',
    data
  })
}
